﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SignalR_ChatRoom_Server.DBM
{
    public class DbContext
    {
        public static SqlSugarClient MainContext
        {
            get
            {
                string dbPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"DB","Chat_Base.db");
                return new SqlSugarClient(
                
                    new ConnectionConfig()
                    {
                        ConnectionString = $"data source={dbPath}",
                        DbType = DbType.Sqlite,
                        IsAutoCloseConnection = true
                    }
                );
            }
        }
    }
}
